package dimensional.one;

import java.util.Scanner;

/*
 * 输入数字，返回显示英文的星期几。
 */
public class ArrayExer {
    public static void main(String[] args) {
        // 定义包含7个单词的数组
        String[] weeks = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

        System.out.print("请输入1-7：");

        // 从键盘获取指定的数值
        Scanner scan = new Scanner(System.in);
        boolean flag = false;
        int week = 0;
        while (!flag) {
            week = scan.nextInt();
            if (week > 7 || week < 1) {
                System.out.print("输入错误！\n请输入1-7：");
                continue;
            }
            flag = true;
        }

        System.out.println(weeks[week - 1]);

    }
}
